<!-- 判断类 -->
<template>
  <LazyRender>
    <px-table :data="data" style="margin-bottom: 18px" class="equip-table inner-tabel" size="small" border>
      <px-table-column v-if="type === 'eqp'" fixed="left" prop="eqpStatusList" label="适用设备状态" min-width="160" show-overflow-tooltip>
        <template #default="scope"> {{ renderStatusDesc(scope.row.eqpStatusList) }}</template>
      </px-table-column>
      <px-table-column
        v-for="(item, colIndex) in judgeTableColumnsDefault"
        :key="`table${colIndex}`"
        :label="item.label"
        :prop="item.prop"
        :min-width="item.minWidth"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :fixed="item.fixed"
      >
      </px-table-column>
      <px-table-column label="内容范围" min-width="200">
        <template #default="scope">
          <template v-if="scope.row.inspectContentRangeCode">
            <TaskFormAction
              :disabled="disabled"
              :validated="validated"
              :isRequired="false"
              :itemProps="[...propsValue, scope.$index, 'result']"
              v-model:itemValue="scope.row.result"
              :statusRange="scope.row.inspectContentRangeValue"
              :status="scope.row.inspectContentRangeCode"
            />
          </template>
        </template>
      </px-table-column>
    </px-table>
  </LazyRender>
</template>
<script setup lang="ts">
import LazyRender from "@/components/LazyRender/index.vue";
import TaskFormAction from "@/views/erc/inspect/task/components/TaskFormAction.vue";
import { ref } from "vue";
const props = defineProps(["data", "propsValue", "disabled", "validated", "type"]);
const judgeTableColumnsDefault = ref([
  { prop: "inspectItem", label: "巡检项", showOverflowTooltip: true, fixed: "left", minWidth: "160" },
  { prop: "inspectContent", label: "巡检内容", showOverflowTooltip: true }
]);
const renderStatusDesc = data => {
  if (data) {
    return data.map(item => item.name).join("/");
  } else {
    return "-";
  }
};
</script>
